#include <QPushButton>
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton* btn = new QPushButton(this);
    btn->move(400, 300);

    // 关联信号和槽，点击关闭
    //connect(btn, &QPushButton::clicked, this, &Widget::close);
    connect(btn, SIGNAL(&QPushButton::clicked), this, SLOT(&Widget::close));
}

Widget::~Widget()
{
    delete ui;
}

